﻿using Colorful.Furniture.CommonDto;
using Colorful.Furniture.Enum;
using Colorful.Furniture.Extensions;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Xml.Linq;
using FreeSql.DataAnnotations;
using System.ComponentModel.DataAnnotations;

namespace Colorful.Furniture.ErpInventoryManagement;

/// <summary>
///  产品分页输出体
/// </summary>
public class InventoryPagedOutputDto
{
    /// <summary>
    ///  产品对应供应商信息列表
    /// </summary>
    public List<RawInventorySupplierOutputDto> SupplierOutputList { get; set; }

    /// <summary>
    ///  产品对应客户信息列表
    /// </summary>
    public List<RawInventoryCustomerOutputDto> CustomerOutputList { get; set; }

    /// <summary>
    ///   编码
    /// </summary>
    public Guid? Id { get; set; }
    
    /// <summary>
    ///  产品类型
    /// </summary>
    public ProductType? ProductType { get; set; }

    /// <summary>
    /// 产品类型名称
    /// </summary>
    public string ProductTypeName => ProductType.ToString();

    /// <summary>
    ///  类型
    /// </summary>
    public string Category { get; set; }
    
    /// <summary>
    ///  供应商
    /// </summary>
    public string Supplier { get; set; }

    /// <summary>
    ///  供应商标识
    /// </summary>
    public Guid? SupplierId { get; set; }

    /// <summary>
    ///  面额
    /// </summary>
    public string FaceRemark { get; set; }

    /// <summary>
    /// 面值
    /// </summary>
    public decimal? FaceAmount { get; set; }

    /// <summary>
    ///  京东SKU
    /// </summary>
    public string JdSku { get; set; }

    /// <summary>
    ///  产品类型
    /// </summary>
    public string ProductTypeTag => ProductType.ToString();

    /// <summary>
    ///  产品颜色
    /// </summary>
    public string ProductTypeColor
    {
        get
        {
            return ProductType switch
            {
                Enum.ProductType.卡券 => "primary",
                Enum.ProductType.直冲 => "success",
                //Enum.ProductType.常规 => "warning",
                _ => "info"
            };
        }
    }
    
    /// <summary>
    ///  产品编号
    /// </summary>
    public string ProductNo { get; set; }

    /// <summary>
    ///   产品名字
    /// </summary>
    public string ProductName { get; set; }
    
    /// <summary>
    ///  排序字段：值越大越靠前
    /// </summary>
    public int Sort { get; set; }

    /// <summary>
    ///  产品规则
    /// </summary>
    public string Rules { get; set; }

    /// <summary>
    ///  是否为测试商品（0 = 否；1 = 是；）
    /// </summary>
    public int? IsTest { get; set; }

    /// <summary>
    ///  备注
    /// </summary>
    public string Remark { get; set; }

    /// <summary>
    ///  是否验证邮箱：1 = 是；0 = 否；
    /// </summary>
    public int? IsCheckEmail { get; set; }

    /// <summary>
    ///  供应商名称合集
    /// </summary>
    public string SupplierName { get; set; }

    /// <summary>
    ///  供应商产品编号合集
    /// </summary>
    public string SupplierProductCode { get; set; }

    /// <summary>
    ///  客户名称合集
    /// </summary>
    public string CustomerName { get; set; }

    /// <summary>
    ///  封面图片
    /// </summary>
    public string CoverImg { get; set; }

    /// <summary>
    ///  图册
    /// </summary>
    [JsonIgnore]
    public string Album { get; set; }

    /// <summary>
    ///  图册
    /// </summary>
    public List<string> AlbumList => Album.StringToGeneric<List<FileStandardDto>>()?.Select(x => x.Url).ToList();
    
    /// <summary>
    ///  创建时间
    /// </summary>
    public DateTime? AddTime { get; set; }

    /// <summary>
    ///  创建时间格式化
    /// </summary>
    public string AddTimeFormat => AddTime.ToNullableDateString("yyyy-MM-dd HH:mm");

    /// <summary>
    ///  创建用户标识
    /// </summary>
    public Guid? AddUserId { get; set; }

    /// <summary>
    ///  创建用户名字
    /// </summary>
    public string AddUserName { get; set; }

    /// <summary>
    ///  状态（0 = 禁用，1 = 启用，2 = 下架，3 = 上架）
    /// </summary>
    public int? Status { get; set; }

    /// <summary>
    /// 状态格式化
    /// </summary>
    public string StatusFormat => Status == 1 ? "启用" : Status == 0 ? "禁用" : Status == 3 ? "上架" : Status == 2 ? "下架" : "错误";

    /// <summary>
    ///  状态颜色
    /// </summary>
    public string StatusColor
    {
        get
        {
            return Status switch
            {
                3 => "success",
                2 => "warning",
                1 => "business",
                0 => "info",
                _ => "danger"
            };
        }
    }

}

/// <summary>
///  产品日志分页
/// </summary>
public class InventoryLogPagedOutputDto
{
    /// <summary>
    ///  标识
    /// </summary>
    public Guid Id { get; set; }

    /// <summary>
    ///  日志时间
    /// </summary>
    public DateTime AddTime { get; set; }

    /// <summary>
    ///  时间格式化
    /// </summary>
    public string AddTimeFormat => AddTime.ToDateString();

    /// <summary>
    ///  产品
    /// </summary>
    public string Product { get; set; }

    /// <summary>
    ///  产品编号
    /// </summary>
    public string ProductNo { get; set; }

    /// <summary>
    ///  改变数量,入库就是正数产品量，出库就是负数产品量
    /// </summary>
    public decimal? ChangeQtyValue { get; set; }

    /// <summary>
    ///  变化之前值
    /// </summary>
    public decimal? BeforeQty1 { get; set; }

    /// <summary>
    ///  变化之后值
    /// </summary>
    public decimal? BeforeQty2 { get; set; }

    /// <summary>
    ///  变化之前数量
    /// </summary>
    public decimal? AfterQty1 { get; set; }

    /// <summary>
    ///  变化之后数量
    /// </summary>
    public decimal? AfterQty2 { get; set; }

    /// <summary>
    ///  备注
    /// </summary>
    public string Remark { get; set; }
}

/// <summary>
///  产品表单
/// </summary>
public class InventoryFormOutputDto
{
    /// <summary>
    ///  编码
    /// </summary>
    public Guid? Id { get; set; }
    
    /// <summary>
    ///  供应商标识
    /// </summary>
    public Guid? SupplierId { get; set; }
    
    /// <summary>
    ///  图册，方便客户进行区分
    /// </summary>
    [JsonIgnore]
    public string Album { get; set; }

    /// <summary>
    ///  图册
    /// </summary>
    public List<FileStandardDto> AlbumList => Album.StringToGeneric<List<FileStandardDto>>();

    /// <summary>
    ///  产品类型 
    /// </summary>
    public string ProductType { get; set; }

    /// <summary>
    ///  产品分类编码
    /// </summary>
    public Guid? ProductCategoryId { get; set; }

    /// <summary>
    ///  分类编码
    /// </summary>
    public Guid? CategoryId { get; set; }
    
    /// <summary>
    ///  类型
    /// </summary>
    public string Category { get; set; }

    /// <summary>
    ///  产品编号 
    /// </summary>
    public string ProductNo { get; set; }
    
    /// <summary>
    ///   产品名字
    /// </summary>
    public string ProductName { get; set; }

    /// <summary>
    ///  是否为测试商品（0 = 否；1 = 是；）
    /// </summary>
    public int? IsTest { get; set; }

    /// <summary>
    ///  排序字段：值越大越靠前
    /// </summary>
    public int Sort { get; set; }

    /// <summary>
    ///  京东SKU
    /// </summary>
    public string JdSku { get; set; }

    /// <summary>
    ///  是否验证邮箱：1 = 是；0 = 否；
    /// </summary>
    public int? IsCheckEmail { get; set; }

    /// <summary>
    ///  推广地址 
    /// </summary>
    public string Link { get; set; }

    /// <summary>
    ///  参考链接地址 
    /// </summary>
    public string ReferenceLink { get; set; }

    /// <summary>
    ///  备案信息 
    /// </summary>
    public string Filings { get; set; }

    /// <summary>
    /// 是否跳转其余推广页：0=不跳转；1=跳转；
    /// </summary>
    public int? IsJumpOther { get; set; }

    /// <summary>
    /// 是否二次确认：0=不需要；1=需要；
    /// </summary>
    public int? IsConfirm { get; set; }

    /// <summary>
    ///  封面图片
    /// </summary>
    public string CoverImg { get; set; }

    /// <summary>
    ///  封面图片数组
    /// </summary>
    public List<FileStandardDto> CoverImgList => !string.IsNullOrWhiteSpace(CoverImg) ? new List<FileStandardDto> { new() { Uid = Guid.NewGuid().ToString("N"), Url = CoverImg, ThumbnailUrl = CoverImg } } : new List<FileStandardDto>();

    /// <summary>
    ///  输入框背景图
    /// </summary>
    public string BackgroundImg { get; set; }

    /// <summary>
    ///  输入框背景图数组
    /// </summary>
    public List<FileStandardDto> BackgroundImgList => !string.IsNullOrWhiteSpace(BackgroundImg) ? new List<FileStandardDto> { new() { Uid = Guid.NewGuid().ToString("N"), Url = BackgroundImg, ThumbnailUrl = BackgroundImg } } : new List<FileStandardDto>();


    /// <summary>
    ///  商品内容图
    /// </summary>
    public string Content { get; set; }

    /// <summary>
    ///  商品内容图数组
    /// </summary>
    public List<FileStandardDto> ContentList => !string.IsNullOrWhiteSpace(Content) ? new List<FileStandardDto> { new() { Uid = Guid.NewGuid().ToString("N"), Url = Content, ThumbnailUrl = Content } } : new List<FileStandardDto>();

}

/// <summary>
///  产品信息
/// </summary>
public class InventoryRawFromOutputDto
{
    /// <summary>
    ///  编码
    /// </summary>
    public Guid? Id { get; set; }
    
    /// <summary>
    ///  图册，方便客户进行区分
    /// </summary>
    [JsonIgnore]
    public string Album { get; set; }

    /// <summary>
    ///  图册
    /// </summary>
    public List<FileStandardDto> AlbumList => Album.StringToGeneric<List<FileStandardDto>>();

    /// <summary>
    ///  产品类型 
    /// </summary>
    public string ProductType { get; set; }

    /// <summary>
    ///  分类编码
    /// </summary>
    public Guid? CategoryId { get; set; }
    
    /// <summary>
    ///  类型
    /// </summary>
    public string Category { get; set; }

    /// <summary>
    ///  产品编号 
    /// </summary>
    public string ProductNo { get; set; }

    /// <summary>
    ///   产品名字
    /// </summary>
    public string ProductName { get; set; }

    /// <summary>
    ///  面额
    /// </summary>
    public string FaceRemark { get; set; }

    /// <summary>
    /// 面值
    /// </summary>
    public decimal? FaceAmount { get; set; }

    /// <summary>
    ///  产品规则
    /// </summary>
    public string Rules { get; set; }
    
    /// <summary>
    ///  是否为测试商品（0 = 否；1 = 是；）
    /// </summary>
    public int? IsTest { get; set; }

    /// <summary>
    ///  备注
    /// </summary>
    public string Remark { get; set; }

    /// <summary>
    ///  是否验证邮箱：1 = 是；0 = 否；
    /// </summary>
    public int? IsCheckEmail { get; set; }

    /// <summary>
    ///  供应商名称合集
    /// </summary>
    public string SupplierName { get; set; }

    /// <summary>
    ///  客户名称合集
    /// </summary>
    public string CustomerName { get; set; }

    /// <summary>
    ///  排序字段：值越大越靠前
    /// </summary>
    public int Sort { get; set; }

    /// <summary>
    ///  京东SKU
    /// </summary>
    public string JdSku { get; set; }

    /// <summary>
    ///  推广地址 
    /// </summary>
    public string Link { get; set; }

    /// <summary>
    ///  参考链接地址 
    /// </summary>
    public string ReferenceLink { get; set; }


    /// <summary>
    ///  查产品产品sku集合
    /// </summary>
    public List<InventorySkuOutputDto> InventorySkus { get; set; }

    /// <summary>
    ///  备案信息 
    /// </summary>
    public string Filings { get; set; }

    /// <summary>
    /// 是否跳转其余推广页：0=不跳转；1=跳转；
    /// </summary>
    public int? IsJumpOther { get; set; }

    /// <summary>
    /// 是否二次确认：0=不需要；1=需要；
    /// </summary>
    public int? IsConfirm { get; set; }

    /// <summary>
    ///  输入框背景图
    /// </summary>
    public string BackgroundImg { get; set; }

    /// <summary>s
    ///  输入框背景图数组
    /// </summary>
    public List<FileStandardDto> BackgroundImgList => !string.IsNullOrWhiteSpace(BackgroundImg) ? new List<FileStandardDto> { new() { Uid = Guid.NewGuid().ToString("N"), Url = BackgroundImg, ThumbnailUrl = BackgroundImg } } : new List<FileStandardDto>();


    ///// <summary>
    /////  封面图片
    ///// </summary>
    //public string CoverImg { get; set; }

    ///// <summary>
    /////  封面图片数组
    ///// </summary>
    //public List<FileStandardDto> CoverImgList => !string.IsNullOrWhiteSpace(CoverImg) ? new List<FileStandardDto> { new() { Uid = Guid.NewGuid().ToString("N"), Url = CoverImg, ThumbnailUrl = CoverImg } } : new List<FileStandardDto>();

    ///// <summary>
    /////  商品内容图
    ///// </summary>
    //public string Content { get; set; }

    ///// <summary>
    /////  商品内容图数组
    ///// </summary>
    //public List<FileStandardDto> ContentList => !string.IsNullOrWhiteSpace(Content) ? new List<FileStandardDto> { new() { Uid = Guid.NewGuid().ToString("N"), Url = Content, ThumbnailUrl = Content } } : new List<FileStandardDto>();

    /// <summary>
    ///  封面图片
    /// </summary>
    [JsonIgnore]
    public string CoverImg { get; set; }

    /// <summary>
    ///  封面图片-图册
    /// </summary>
    public List<FileStandardDto> CoverImgList => CoverImg.StringToGeneric<List<FileStandardDto>>();

    /// <summary>
    ///  活动内容图
    /// </summary>
    [JsonIgnore]
    public string Content { get; set; }

    /// <summary>
    ///  活动内容图-图册
    /// </summary>
    public List<FileStandardDto> ContentList => Content.StringToGeneric<List<FileStandardDto>>();

    /// <summary>
    ///  二次确认背景图
    /// </summary>
    public string SecondPopImg { get; set; }

    /// <summary>s
    ///  二次确认背景图数组
    /// </summary>
    public List<FileStandardDto> SecondPopImgList => !string.IsNullOrWhiteSpace(SecondPopImg) ? new List<FileStandardDto> { new() { Uid = Guid.NewGuid().ToString("N"), Url = SecondPopImg, ThumbnailUrl = SecondPopImg } } : new List<FileStandardDto>();

}


/// <summary>
/// 客户端输出体
/// </summary>
public class InventoryClientOutputDto
{

    /// <summary>
    ///   编码
    /// </summary>
    public Guid? Id { get; set; }

    /// <summary>
    ///  产品编号 
    /// </summary>
    public string ProductNo { get; set; }

    /// <summary>
    ///   产品名字
    /// </summary>
    public string ProductName { get; set; }

    /// <summary>
    ///  备案信息 
    /// </summary>
    public string Filings { get; set; }

    /// <summary>
    /// 是否跳转其余推广页：0=不跳转；1=跳转；
    /// </summary>
    public int? IsJumpOther { get; set; }

    /// <summary>
    /// 是否二次确认：0=不需要；1=需要；
    /// </summary>
    public int? IsConfirm { get; set; }

    /// <summary>
    ///  输入框背景图
    /// </summary>
    public string BackgroundImg { get; set; }

    /// <summary>
    ///  封面图片
    /// </summary>
    public List<FileStandardDto> CoverImgList => CoverImg.StringToGeneric<List<FileStandardDto>>();

    /// <summary>
    ///  封面图片-图册
    /// </summary>
    [JsonIgnore]
    public string CoverImg { get; set; }

    /// <summary>
    ///  活动内容图
    /// </summary>
    public List<FileStandardDto> ContentList => Content.StringToGeneric<List<FileStandardDto>>();

    /// <summary>
    ///  活动内容图-图册
    /// </summary>
    [JsonIgnore]
    public string Content { get; set; }

    /// <summary>
    ///  输入框背景图
    /// </summary>
    public string SecondPopImg { get; set; }

}



/// <summary>
///  产品sku输出
/// </summary>
public class InventorySkuOutputDto
{
    /// <summary>
    ///   编码
    /// </summary>
    public Guid? Id { get; set; }

    /// <summary>
    ///  排序
    /// </summary>
    public int? Sort { get; set; }

    /// <summary>
    ///  供应商标识
    /// </summary>
    public Guid? SupplierId { get; set; }

    /// <summary>
    ///  供应商产品名称
    /// </summary>
    public string SupplierProductName { get; set; }

    /// <summary>
    ///  供应商产品编号
    /// </summary>
    public string SupplierProductNo { get; set; }

    /// <summary>
    ///  供应商成本总价
    /// </summary>
    public string CostPrice { get; set; }

    /// <summary>
    ///  供应商成本单价
    /// </summary>
    public string CostUnitPrice { get; set; }

    /// <summary>
    ///  是否启用
    /// </summary>
    public int? IsEnable { get; set; }

    /// <summary>
    ///  换算比例：1个客户订单数量 = * 个供应商订单数量
    /// </summary>
    public int? SupplierQty { get; set; }

    /// <summary>
    ///  下游最大提交数量
    /// </summary>
    public int? MaxQty { get; set; }

    /// <summary>
    ///  下游最小提交数量
    /// </summary>
    public int? MinQty { get; set; }

    /// <summary>
    ///  帐号所属类型
    /// </summary>
    public string AcctType { get; set; }

    /// <summary>
    ///  折扣
    /// </summary>
    public string Discount { get; set; }

}


/// <summary>
///  产品关联客户输出体
/// </summary>
public class InventoryWithCustomerFromOutputDto
{
    /// <summary>
    ///  编码
    /// </summary>
    public Guid? Id { get; set; }

    /// <summary>
    ///  产品编号 
    /// </summary>
    public string ProductNo { get; set; }

    /// <summary>
    ///   产品名字
    /// </summary>
    public string ProductName { get; set; }

    /// <summary>
    ///  面额
    /// </summary>
    public string FaceRemark { get; set; }

    /// <summary>
    /// 面值
    /// </summary>
    public int? FaceAmount { get; set; }

    /// <summary>
    ///  客户集合
    /// </summary>
    public List<InventoryWithCustomerOutputDto> InventoryWithCustomers { get; set; }

}


/// <summary>
///  产品关联客户请求体
/// </summary>
public class InventoryWithCustomerOutputDto
{
    /// <summary>
    ///   编码
    /// </summary>
    public Guid? Id { get; set; }

    /// <summary>
    ///   产品编码
    /// </summary>
    public Guid? InventoryId { get; set; }

    /// <summary>
    ///  产品编号
    /// </summary>
    public string ProductNo { get; set; }

    /// <summary>
    ///  客户编码
    /// </summary>
    public Guid? CustomerId { get; set; }

    /// <summary>
    ///  折扣
    /// </summary>
    public decimal? Discount { get; set; }

    /// <summary>
    ///  售价
    /// </summary>
    public decimal? SalePrice { get; set; }

    /// <summary>
    ///  手续费
    /// </summary>
    public decimal? Commission { get; set; }

}

/// <summary>
///  下游客户产品分页输出体
/// </summary>
public class InventoryWithCustomerPagedOutputDto
{
    /// <summary>
    ///   编码
    /// </summary>
    public Guid? Id { get; set; }

    /// <summary>
    ///  产品类型
    /// </summary>
    public ProductType? ProductType { get; set; }

    /// <summary>
    /// 产品类型名称
    /// </summary>
    public string ProductTypeName => ProductType.ToString();
    
    /// <summary>
    ///  面额
    /// </summary>
    public string FaceRemark { get; set; }

    /// <summary>
    /// 面值
    /// </summary>
    public int? FaceAmount { get; set; }

    /// <summary>
    ///  产品类型
    /// </summary>
    public string ProductTypeTag => ProductType.ToString();
    
    /// <summary>
    ///  产品编号
    /// </summary>
    public string ProductNo { get; set; }

    /// <summary>
    ///   产品名字
    /// </summary>
    public string ProductName { get; set; }
    
    /// <summary>
    ///  产品规则
    /// </summary>
    public string Rules { get; set; }

    /// <summary>
    ///  备注
    /// </summary>
    public string Remark { get; set; }

    /// <summary>
    ///  折扣
    /// </summary>
    public decimal? Discount { get; set; }

    /// <summary>
    ///  售价
    /// </summary>
    public decimal? SalePrice { get; set; }

    /// <summary>
    ///  手续费
    /// </summary>
    public decimal? Commission { get; set; }

}


/// <summary>
///  客户->产品分页输出体
/// </summary>
public class CustomerInventoryPagedOutputDto
{
    /// <summary>
    ///   编码
    /// </summary>
    public Guid? Id { get; set; }

    /// <summary>
    ///  客户名称
    /// </summary>
    public string CustomerName { get; set; }

    /// <summary>
    ///  折扣
    /// </summary>
    public decimal? Discount { get; set; }

    /// <summary>
    ///  售价
    /// </summary>
    public decimal? SalePrice { get; set; }

    /// <summary>
    ///  手续费
    /// </summary>
    public decimal? Commission { get; set; }

    /// <summary>
    ///  产品类型
    /// </summary>
    public ProductType? ProductType { get; set; }

    /// <summary>
    /// 产品类型名称
    /// </summary>
    public string ProductTypeName => ProductType.ToString();

    /// <summary>
    ///  类型
    /// </summary>
    public string Category { get; set; }

    /// <summary>
    ///  供应商
    /// </summary>
    public string Supplier { get; set; }

    /// <summary>
    ///  客户编码
    /// </summary>
    public string CustomerCode { get; set; }

    /// <summary>
    ///  面额
    /// </summary>
    public string FaceRemark { get; set; }

    /// <summary>
    /// 面值
    /// </summary>
    public int? FaceAmount { get; set; }

    /// <summary>
    ///  产品类型
    /// </summary>
    public string ProductTypeTag => ProductType.ToString();

    /// <summary>
    ///  产品颜色
    /// </summary>
    public string ProductTypeColor
    {
        get
        {
            return ProductType switch
            {
                Enum.ProductType.卡券 => "primary",
                Enum.ProductType.直冲 => "success",
                //Enum.ProductType.常规 => "warning",
                _ => "info"
            };
        }
    }

    /// <summary>
    ///  产品编号
    /// </summary>
    public string ProductNo { get; set; }

    /// <summary>
    ///   产品名字
    /// </summary>
    public string ProductName { get; set; }

    /// <summary>
    ///  排序字段：值越大越靠前
    /// </summary>
    public string Sort { get; set; }

    /// <summary>
    ///  产品规则
    /// </summary>
    public string Rules { get; set; }

    /// <summary>
    ///  是否为测试商品（0 = 否；1 = 是；）
    /// </summary>
    public int? IsTest { get; set; }

    /// <summary>
    ///  备注
    /// </summary>
    public string Remark { get; set; }

    /// <summary>
    ///  供应商名称合集
    /// </summary>
    public string SupplierName { get; set; }
    
    /// <summary>
    ///  创建时间
    /// </summary>
    public DateTime? AddTime { get; set; }

    /// <summary>
    ///  创建时间格式化
    /// </summary>
    public string AddTimeFormat => AddTime.ToNullableDateString("yyyy-MM-dd HH:mm");
    
    /// <summary>
    ///  创建用户名字
    /// </summary>
    public string AddUserName { get; set; }

    /// <summary>
    ///  状态（0 = 禁用，1 = 启用，2 = 下架，3 = 上架）
    /// </summary>
    public int? Status { get; set; }

    /// <summary>
    ///  推广地址 
    /// </summary>
    public string Link { get; set; }

    /// <summary>
    ///  参考链接地址 
    /// </summary>
    public string ReferenceLink { get; set; }
    
    /// <summary>
    /// 状态格式化
    /// </summary>
    public string StatusFormat => Status == 1 ? "启用" : Status == 0 ? "禁用" : Status == 3 ? "上架" : Status == 2 ? "下架" : "错误";

    /// <summary>
    ///  状态颜色
    /// </summary>
    public string StatusColor
    {
        get
        {
            return Status switch
            {
                3 => "success",
                2 => "warning",
                1 => "business",
                0 => "info",
                _ => "danger"
            };
        }
    }

}

/// <summary>
///  产品->供应商分页输出体
/// </summary>
public class InventorySupplierPagedOutputDto
{
    /// <summary>
    ///   编码
    /// </summary>
    public Guid? Id { get; set; }

    /// <summary>
    ///  采购成本单价
    /// </summary>
    public decimal? CostPrice { get; set; }

    /// <summary>
    ///  供应商成本单价
    /// </summary>
    public decimal? CostUnitPrice { get; set; }
    
    /// <summary>
    ///  换算比例：1个客户订单数量 = * 个供应商订单数量
    /// </summary>
    public int? SupplierQty { get; set; }

    /// <summary>
    ///  下游最大提交数量
    /// </summary>
    public int? MaxQty { get; set; }

    /// <summary>
    ///  下游最小提交数量
    /// </summary>
    public int? MinQty { get; set; }


    /// <summary>
    ///  产品类型
    /// </summary>
    public ProductType? ProductType { get; set; }

    /// <summary>
    /// 产品类型名称
    /// </summary>
    public string ProductTypeName => ProductType.ToString();

    /// <summary>
    ///  类型
    /// </summary>
    public string Category { get; set; }

    /// <summary>
    ///  供应商
    /// </summary>
    public string Supplier { get; set; }

    /// <summary>
    ///  面额
    /// </summary>
    public string FaceRemark { get; set; }

    /// <summary>
    /// 面值
    /// </summary>
    public int? FaceAmount { get; set; }

    /// <summary>
    ///  产品类型
    /// </summary>
    public string ProductTypeTag => ProductType.ToString();

    /// <summary>
    ///  产品颜色
    /// </summary>
    public string ProductTypeColor
    {
        get
        {
            return ProductType switch
            {
                Enum.ProductType.卡券 => "primary",
                Enum.ProductType.直冲 => "success",
                //Enum.ProductType.常规 => "warning",
                _ => "info"
            };
        }
    }

    /// <summary>
    ///  产品编号
    /// </summary>
    public string ProductNo { get; set; }

    /// <summary>
    ///   产品名字
    /// </summary>
    public string ProductName { get; set; }

    /// <summary>
    ///  排序字段：值越大越靠前
    /// </summary>
    public string Sort { get; set; }

    /// <summary>
    ///  产品规则
    /// </summary>
    public string Rules { get; set; }

    /// <summary>
    ///  是否为测试商品（0 = 否；1 = 是；）
    /// </summary>
    public int? IsTest { get; set; }

    /// <summary>
    ///  备注
    /// </summary>
    public string Remark { get; set; }

    /// <summary>
    ///  供应商名称合集
    /// </summary>
    public string SupplierName { get; set; }

    /// <summary>
    ///  客户名称合集
    /// </summary>
    public string CustomerName { get; set; }

    /// <summary>
    ///  创建时间
    /// </summary>
    public DateTime? AddTime { get; set; }

    /// <summary>
    ///  创建时间格式化
    /// </summary>
    public string AddTimeFormat => AddTime.ToNullableDateString("yyyy-MM-dd HH:mm");

    /// <summary>
    ///  创建用户名字
    /// </summary>
    public string AddUserName { get; set; }

    /// <summary>
    ///  状态（0 = 禁用，1 = 启用，2 = 下架，3 = 上架）
    /// </summary>
    public int? Status { get; set; }


}

/// <summary>
///  产品供应商列表
/// </summary>
public class RawInventorySupplierOutputDto
{
    public Guid InventoryId { get; set; }

    public Guid Id { get; set; }

    /// <summary>
    ///  供应商
    /// </summary>
    public string SupplierName { get; set; }

    /// <summary>
    ///  客户名称合集
    /// </summary>
    public string CustomerName { get; set; }

    /// <summary>
    ///  采购成本价
    /// </summary>
    public decimal? CostPrice { get; set; }

    /// <summary>
    ///  供应商成本单价
    /// </summary>
    public decimal? CostUnitPrice { get; set; }

    /// <summary>
    ///  换算比例：1个客户订单数量 = * 个供应商订单数量
    /// </summary>
    public int? SupplierQty { get; set; }

    /// <summary>
    ///  下游最大提交数量
    /// </summary>
    public int? MaxQty { get; set; }

    /// <summary>
    ///  下游最小提交数量
    /// </summary>
    public int? MinQty { get; set; }

    /// <summary>
    ///  帐号所属类型
    /// </summary>
    public string AcctType { get; set; }

}

/// <summary>
///  产品客户列表
/// </summary>
public class RawInventoryCustomerOutputDto
{
    public Guid? InventoryId { get; set; }

    public Guid Id { get; set; }

    /// <summary>
    ///  客户名称
    /// </summary>
    public string CustomerName { get; set; }
    
    /// <summary>
    ///  计价
    /// </summary>
    public decimal? Discount { get; set; }

    /// <summary>
    ///  售价
    /// </summary>
    public decimal? SalePrice { get; set; }

    /// <summary>
    ///  手续费
    /// </summary>
    public decimal? Commission { get; set; }

}

/// <summary>
/// 商品关系视图输出体
/// </summary>
public class ViewInventoryOutputDto
{
    /// <summary>
    ///  供应商编码
    /// </summary>
    public Guid? SupplierId { get; set; }

    /// <summary>
    ///  供应商编号
    /// </summary>
    public int? SupplierCode { get; set; }

    /// <summary>
    ///  供应商名称
    /// </summary>
    public string SupplierName { get; set; }

    /// <summary>
    ///  客户名称合集
    /// </summary>
    public string CustomerName { get; set; }

    /// <summary>
    ///  供应商产品编号
    /// </summary>
    public string SupplierProductNo { get; set; }

    /// <summary>
    ///  供应商产品名称
    /// </summary>
    public string SupplierProductName { get; set; }

    /// <summary>
    ///  采购成本单价
    /// </summary>
    public decimal? CostPrice { get; set; }

    /// <summary>
    ///  供应商成本单价
    /// </summary>
    public decimal? CostUnitPrice { get; set; }

    /// <summary>
    ///  换算比例：1个客户订单数量 = * 个供应商订单数量
    /// </summary>
    public int? SupplierQty { get; set; }

    /// <summary>
    ///  下游最大提交数量
    /// </summary>
    public int? MaxQty { get; set; }

    /// <summary>
    ///  下游最小提交数量
    /// </summary>
    public int? MinQty { get; set; }

    /// <summary>
    ///  是否启用：1 = 是；0 = 否；
    /// </summary>
    public int? IsEnable { get; set; }

    /// <summary>
    ///  上游商户编号
    /// </summary>
    public string MerchantCode { get; set; }

    /// <summary>
    ///   产品名字
    /// </summary>
    public string ProductName { get; set; }

    /// <summary>
    ///  产品编号 
    /// </summary>
    public string ProductNo { get; set; }

    /// <summary>
    ///  面额
    /// </summary>
    public string FaceRemark { get; set; }

    /// <summary>
    /// 面值
    /// </summary>
    public int? FaceAmount { get; set; }

    /// <summary>
    ///  状态（0 = 禁用，1 = 启用，2 = 下架，3 = 上架）
    /// </summary>
    public int? Status { get; set; }

    /// <summary>
    ///  产品类型
    /// </summary>
    public ProductType? ProductType { get; set; }


}


/// <summary>
///  管理员选项输出
/// </summary>
public class InventoryOptionOutputDto : OptionOutputIdDto
{

    /// <summary>
    ///  产品编号 
    /// </summary>
    public string ProductNo { get; set; }

    /// <summary>
    ///  售价
    /// </summary>
    public decimal? SalePrice { get; set; }


}


/// <summary>
///  产品关联SkuNew输出体
/// </summary>
public class InventoryShopOutputDto
{

    /// <summary>
    ///   编码
    /// </summary>
    public Guid Id { get; set; }

    /// <summary>
    ///   产品编码
    /// </summary>
    public Guid? InventoryId { get; set; }

    /// <summary>
    ///  产品编号
    /// </summary>
    public string ProductNo { get; set; }
    
    /// <summary>
    /// 抖音商品的skuId
    /// </summary>
    public string SkuId { get; set; }

    /// <summary>
    ///  提交订单时刻的商品数量换算比例（1：Number）
    /// </summary>
    public int? Number { get; set; }

}


/// <summary>
///  产品店铺信息输出体
/// </summary>
public class InventoryShopFromOutputDto
{
    /// <summary>
    ///  编码
    /// </summary>
    public Guid? Id { get; set; }

    /// <summary>
    ///  产品编号 
    /// </summary>
    public string ProductNo { get; set; }

    /// <summary>
    ///   产品名字
    /// </summary>
    public string ProductName { get; set; }

    /// <summary>
    ///  面额
    /// </summary>
    public string FaceRemark { get; set; }

    /// <summary>
    /// 面值
    /// </summary>
    public int? FaceAmount { get; set; }

    /// <summary>
    ///  店铺设置集合
    /// </summary>
    public List<InventoryShopOutputDto> InventoryShops { get; set; }

}
